Skip to content

Enhanced Interfaces: Implement endpoints & fields related to VPCs and non-interface networking #526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: proj/enhanced-interfaces
Choose a base branch
from

Conversation

lgarber-akamai
Copy link
Contributor

@lgarber-akamai lgarber-akamai commented Apr 9, 2025

📝 Description

This pull request adds support for Enhanced Interfaces endpoints and fields related to VPCs and non-interface networking.

✔️ How to Test

The following test steps assume you have pulled down this PR locally and run make install. Additionally, these test steps require that your Linode account has access to Enhanced Interfaces.

Unit Testing

make test-unit

Integration Testing

make test-int TEST_COMMAND=linode_client
make test-int TEST_COMMAND=models/networking

Manual Testing

  1. In a linode_api4-python sandbox environment (e.g. dx-devenv), run the following:
import os

from linode_api4 import LinodeClient, FirewallCreateDevicesOptions, IPAddress

client = LinodeClient(os.getenv("LINODE_TOKEN"), base_url="https://api.linode.com/v4beta")

region = next(region for region in client.regions() if "Linode Interfaces" in region.capabilities)

global_firewall_settings = client.networking.firewall_settings()

instance = client.linode.instance_create(
    label="linode-api4-test",
    region=region.id,
    ltype="g6-nanode-1"
)

firewall = client.networking.firewall_create(
    label="linode-api4-test",
    rules={
        "inbound_policy": "DROP",
        "outbound_policy": "DROP"
    },
    devices=FirewallCreateDevicesOptions(
        linodes=[instance.id],
    )
)

instance_ip = client.load(IPAddress, instance.ipv4[0])

print("Region with `Linode Interfaces` capability:", region.id)
print("Global firewall settings:", global_firewall_settings._raw_json)
print("Firewall device entity:", vars(firewall.devices[0].entity))

instance.delete()
firewall.delete()
  1. Ensure the output looks similar to the following:
Region with `Linode Interfaces` capability: ap-west
Global firewall settings: {'default_firewall_ids': {'linode': None, 'nodebalancer': None, 'public_interface': None, 'vpc_interface': None}}
Firewall device entity: {'id': 74954050, 'type': 'linode', 'label': 'linode-api4-test', 'url': '/v4/linode/instances/74954050'}

@lgarber-akamai lgarber-akamai added the new-feature for new features in the changelog. label Apr 9, 2025
@lgarber-akamai lgarber-akamai changed the base branch from dev to proj/enhanced-interfaces April 9, 2025 14:55
@lgarber-akamai lgarber-akamai changed the title Enhanced Interfaces: Implement endpoints & fields related to VPCs and IPs Enhanced Interfaces: Implement endpoints & fields related to VPCs and non-interface networking Apr 9, 2025
@@ -73,6 +77,47 @@ def test_get_networking_rules(test_linode_client, test_firewall):
assert "outbound_policy" in str(rules)


@pytest.fixture
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only added some fairly minimal integration testing here since a lot of it would depend on the new interface resources being supported, which will be done in a future ticket.

@lgarber-akamai lgarber-akamai force-pushed the new/enhanced-interfaces-vpc branch from d4bcc69 to bedda1f Compare April 10, 2025 16:28
@lgarber-akamai lgarber-akamai marked this pull request as ready for review April 10, 2025 16:29
@lgarber-akamai lgarber-akamai requested a review from a team as a code owner April 10, 2025 16:29
@lgarber-akamai lgarber-akamai requested review from ykim-akamai and ezilber-akamai and removed request for a team April 10, 2025 16:29
Copy link
Contributor

@ezilber-akamai ezilber-akamai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are passing locally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature for new features in the changelog.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants